<?php
class mycnx {

var $confxml = "config.xml";
var $server = "";
var $user = "";
var $pass = "";
var $db= "";
var $conexion = "";
var $tabla="";
var $campos="";
var $pk="";
var $where="";
var $value="";
var $orderby="";

    function __construct(){
        
        if($_SESSION['document_root']){
            if (file_exists($_SESSION['document_root'].$this->confxml)){
                $this->doc = new DOMDocument();
                $this->doc->load($_SESSION['document_root'].$this->confxml);
            }
        }
         else{
            if (file_exists($document_root.$this->confxml)){
                $this->doc = new DOMDocument();
                $this->doc->load($document_root.$this->confxml);
            }
         }
            $this->myconf = $this->doc->getElementsByTagName('mysql')->item(0);
            $this->server = $this->myconf->getElementsByTagName("host")->item(0)->nodeValue;
            $this->user = $this->myconf->getElementsByTagName("usuario")->item(0)->nodeValue;
            $this->pass = $this->myconf->getElementsByTagName("clave")->item(0)->nodeValue;
            $this->db = $this->myconf->getElementsByTagName("database")->item(0)->nodeValue;
	       
	}
        
        
	function select ($sql)
	{
		
		$conexion = new mysqli($this->server, $this->user, $this->pass, $this->db);
                $temp = $conexion->query("USE $this->db");
		$temp = $conexion->query($sql);
		return $temp;
		
	
	
	}
	
	function insert ($sql)
	{
	    
		$conexion = new mysqli($this->server, $this->user, $this->pass, $this->db);
                $conexion->query("USE $this->db");
		$conexion->query($sql);
		
	}
	
        
        function update ($sql)
	{
	    
		$conexion = new mysqli($this->server, $this->user, $this->pass, $this->db);
                $conexion->query("USE $this->db");
		$conexion->query($sql);
		
	}
        
        function delete ($sql)
	{
	    
		$conexion = new mysqli($this->server, $this->user, $this->pass, $this->db);
                $conexion->query("USE $this->db");
		$conexion->query($sql);
		
	}

        
        
        function sqlhtml ($sql)
	{
	    
		$conexion = new mysqli($this->server, $this->user, $this->pass, $this->db);
                $conexion->query("USE $this->db");
		$conexion->query($sql);
		
	}

}

?>